package com.mujin.keji.collectionsystem.common;

/**
 * ^---^---^---^---^---^---^---^
 * --v---v---v---v---v---v---v--
 *
 * @author zou.cp
 * @version 1.0
 * @Description 外访分配状态
 * @createTime 2019年05月04日 21:22*
 * log.info()
 */
public enum VisitStatusEnum {

    VISIT_JINXINGZHONG("jinxingzhong","进行中",1),
    VISIT_YIWAIFANG("yiwaifang","已外访",2),
    VISIT_WANCHENG("wancheng","已完成",3),
    ;

    private String code;
    private String value;
    private Integer status;

    VisitStatusEnum(String code, String value,Integer status) {
        this.code = code;
        this.value = value;
        this.status =status;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }


    public static Integer getStatusByCode(String code){

        for (VisitStatusEnum visitStatus: VisitStatusEnum.values()) {
            if(visitStatus.getCode().equals(code)){
                return visitStatus.getStatus();
            }
        }
        return 1;
    }

    public static String getCodeByStatus(Integer status){

        for (VisitStatusEnum visitStatus: VisitStatusEnum.values()) {
            if(visitStatus.getStatus().equals(status)){
                return visitStatus.getCode();
            }
        }
        return VISIT_JINXINGZHONG.getCode();
    }


}



